/**
 * harmony.bean.Action.java
 * @author xavier.miorcec@elomobile.com
 * @12 déc. 2008
 * @ELO_dev_bernardi_200812
 */
package com.elomobile.harmony.bean.generationElo;

import java.util.ArrayList;
import java.util.List;

import com.elomobile.harmony.utils.UtilsBernardi;

public class Action {

	private String codeAction;
	private int typeAction;
	private float quantite;
	private String unite;
	private String infoAction;
	private int etatAction;
	private List<UniteQuantite> listeUniteQuantite;
	private String codeCommande;
	private String neutraliteCommercial;
	private String portDu;
	private String commentaireAction;

	private String noDossier;
	private String numeroBon;
	private String typeLigne;
	private String vehicule;
	private int nbPaletteChargee;
	private int nbPaletteRendu;

	private int numeroSequence;

	private String passageAQuai = "";

	/**
	 * @return the passageAQuai
	 */
	public String getPassageAQuai() {
		return passageAQuai;
	}

	/**
	 * @param passageAQuai the passageAQuai to set
	 */
	public void setPassageAQuai(String passageAQuai) {
		this.passageAQuai = this.passageAQuai + passageAQuai;
	}

	public void removeVirgulePassageAQuai() {
		this.passageAQuai = UtilsBernardi.removeWhileIsLast(this.passageAQuai, ", ");
	}

	/**
	 * Formatage du passage à quai .
	 * @return
	 */
	public String formatPassageAQuai() {
		String infoPassageAQuai = "";
		if (this.passageAQuai.length() > 0) {
			infoPassageAQuai = "Passage à quai : " + this.passageAQuai + "\r\n";
		}
		return infoPassageAQuai;
	}

	private String couleurFond;
	private String couleurEcriture;

	/**
	 * @return the couleurFond
	 */
	public String getCouleurFond() {
		return couleurFond;
	}

	/**
	 * @param couleurFond the couleurFond to set
	 */
	public void setCouleurFond(String couleurFond) {
		this.couleurFond = couleurFond;
	}

	/**
	 * @return the couleurEcriture
	 */
	public String getCouleurEcriture() {
		return couleurEcriture;
	}

	/**
	 * @param couleurEcriture the couleurEcriture to set
	 */
	public void setCouleurEcriture(String couleurEcriture) {
		this.couleurEcriture = couleurEcriture;
	}

	public static int CHARGEMENT = 1;
	public static int DECHARGEMENT = 2;
	public static int PASSAGE_A_QUAI = 3;

	/**
	 * @return the codeAction
	 */
	public String getCodeAction() {
		return codeAction;
	}

	/**
	 * @return the typeAction
	 */
	public int getTypeAction() {
		return typeAction;
	}

	/**
	 * @return the quantite
	 */
	public float getQuantite() {
		return quantite;
	}

	/**
	 * @return the unite
	 */
	public String getUnite() {
		return unite;
	}

	/**
	 * @return the infoAction
	 */
	public String getInfoAction() {
		this.infoAction = "Commentaire : \r\n" + this.commentaireAction + "\r\n" + formatPassageAQuai() + "Neutralité commerciale : " + this.getNeutraliteCommercial() + "\r\nPort dû : " + this.getPortDu();
		return infoAction;
	}

	/**
	 * @return the etatAction
	 */
	public int getEtatAction() {
		return etatAction;
	}

	/**
	 * @param codeAction the codeAction to set
	 */
	public void setCodeAction(String codeAction) {
		this.codeAction = codeAction;
	}

	/**
	 * @param typeAction the typeAction to set
	 */
	public void setTypeAction(int typeAction) {
		this.typeAction = typeAction;
	}

	/**
	 * @param quantite the quantite to set
	 */
	public void setQuantite(float quantite) {
		this.quantite = quantite;
	}

	/**
	 * @param unite the unite to set
	 */
	public void setUnite(String unite) {
		this.unite = unite;
	}

	/**
	 * @param infoAction the infoAction to set
	 */
	public void setInfoAction(String infoAction) {
		this.infoAction = infoAction;
	}

	/**
	 * @param etatAction the etatAction to set
	 */
	public void setEtatAction(int etatAction) {
		this.etatAction = etatAction;
	}

	/**
	 * @return the listeUniteQuantite
	 */
	public List<UniteQuantite> getListeUniteQuantite() {
		if (listeUniteQuantite == null) {
			listeUniteQuantite = new ArrayList<UniteQuantite>();
		}
		return listeUniteQuantite;
	}

	/**
	 * @param listeUniteQuantite the listeUniteQuantite to set
	 */
	public void setListeUniteQuantite(List<UniteQuantite> listeUniteQuantite) {
		this.listeUniteQuantite = listeUniteQuantite;
	}

	/**
	 * @return the codeCommande
	 */
	public String getCodeCommande() {
		return codeCommande;
	}

	/**
	 * @param codeCommande the codeCommande to set
	 */
	public void setCodeCommande(String codeCommande) {
		this.codeCommande = codeCommande;
	}

	/**
	 * @param neutraliteCommercial the neutraliteCommercial to set
	 */
	public void setNeutraliteCommercial(String neutraliteCommercial) {
		this.neutraliteCommercial = neutraliteCommercial;
	}

	/**
	 * @param portDu the portDu to set
	 */
	public void setPortDu(String portDu) {
		this.portDu = portDu;
	}

	/**
	 * @return the neutraliteCommercial
	 */
	public String getNeutraliteCommercial() {
		if (neutraliteCommercial == null || neutraliteCommercial.trim().length() == 0) {
			return "Non";
		}
		if (neutraliteCommercial.trim().equals("O")) {
			return "Oui";
		} else {
			return "Non";
		}
	}

	/**
	 * @return the portDu
	 */
	public String getPortDu() {
		if (portDu == null || portDu.trim().length() == 0) {
			return "Non";
		}
		if (portDu.trim().equals("O")) {
			return "Oui";
		} else {
			return "Non";
		}
	}

	/**
	 * @return the noDossier
	 */
	public String getNoDossier() {
		return noDossier;
	}

	/**
	 * @return the numeroBon
	 */
	public String getNumeroBon() {
		return numeroBon;
	}

	/**
	 * @return the typeLigne
	 */
	public String getTypeLigne() {
		return typeLigne;
	}

	/**
	 * @param noDossier the noDossier to set
	 */
	public void setNoDossier(String noDossier) {
		this.noDossier = noDossier;
	}

	/**
	 * @param numeroBon the numeroBon to set
	 */
	public void setNumeroBon(String numeroBon) {
		this.numeroBon = numeroBon;
	}

	/**
	 * @param typeLigne the typeLigne to set
	 */
	public void setTypeLigne(String typeLigne) {
		this.typeLigne = typeLigne;
	}

	public String genererCodeAction() {
		return this.noDossier + "_" + this.numeroBon + "_" + this.typeLigne;
	}

	/**
	 * @return the nbPaletteChargee
	 */
	public int getNbPaletteChargee() {
		return nbPaletteChargee;
	}

	/**
	 * @return the nbPaletteRendu
	 */
	public int getNbPaletteRendu() {
		return nbPaletteRendu;
	}

	/**
	 * @param nbPaletteChargee the nbPaletteChargee to set
	 */
	public void setNbPaletteChargee(int nbPaletteChargee) {
		this.nbPaletteChargee = nbPaletteChargee;
	}

	/**
	 * @param nbPaletteRendu the nbPaletteRendu to set
	 */
	public void setNbPaletteRendu(int nbPaletteRendu) {
		this.nbPaletteRendu = nbPaletteRendu;
	}

	/**
	 * @return the commentaireAction
	 */
	public String getCommentaireAction() {
		return commentaireAction;
	}

	/**
	 * @param commentaireAction the commentaireAction to set
	 */
	public void setCommentaireAction(String commentaireAction) {
		this.commentaireAction = commentaireAction;
	}

	public String getVehicule() {
		return vehicule;
	}

	public void setVehicule(String vehicule) {
		this.vehicule = vehicule;
	}

	public int getNumeroSequence() {
		return numeroSequence;
	}

	public void setNumeroSequence(int numeroSequence) {
		this.numeroSequence = numeroSequence;
	}

}
